package com.go.jumping.service;

import com.go.core.bean.JumpingScore;
import com.go.core.bean.RunningScore;
import com.go.core.repo.JumpingScoreRepo;
import com.go.core.repo.RunningScoreRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("jumpService")
public class JumpService {

    @Autowired
    JumpingScoreRepo jumpingScoreRepo;

    // 保存玩家信息
    public JumpingScore save(JumpingScore player){
        return jumpingScoreRepo.save(player);
    }

    public JumpingScore findPlayerByUUID(String uuid){
        return jumpingScoreRepo.findByUUID(uuid);
    }

    // 记录玩家分数
    public int updateScoreByUUID(String uuid, int score){
        return jumpingScoreRepo.updateScoreByUUID(uuid, score);
    }

    // 获取排行榜
    public List<JumpingScore> getScoreBorad(){
        return jumpingScoreRepo.getScoreBorad();
    }
}
